﻿@{
    Layout = null;
}
@*<div>客户信息</div>*@
<script src="~/Scripts/MGJJS/Market/CustomerInfo.js"></script>

<div class="mtlr15">

    <div class="row">
        <div class="col-lg-7 col-md-7 col-sm-7" style="padding:0">
            @*<button class="btn btn-success">
                <i class="glyphicon glyphicon-plus"></i>
                送优惠券
            </button>*@
            <button class="btn btn-success" onclick="$.MGJ.CustomerInfo.GiveHongBao()">
                <i class="glyphicon glyphicon-arrow-down" ></i>
                送红包
            </button>
            <button class="btn btn-success" onclick="$.MGJ.CustomerInfo.GiveData()">
                <i class="glyphicon glyphicon-share-alt"></i>
                送流量
            </button>
            <button type="button" class="btn btn-success" onclick="$.MGJ.CustomerInfo.MarketManageExecl('#MarkeTtable')">
                <i class="glyphicon glyphicon-arrow-down"></i>
                导出EXCEL
            </button>

        </div>
        <div class="col-lg-5 col-md-5 col-sm-5">
            <div class="input-group">
                <input type="text" class="form-control " id="msearch" placeholder="客户名称" onkeydown="if (event.keyCode == 13) { $.MGJ.CustomerInfo.Ajax_MarketUserList(1); }" />
                <span class="input-group-addon" onclick="$.MGJ.CustomerInfo.Ajax_MarketUserList(1);">
                    <span class="glyphicon glyphicon-search"></span>
                </span>
                @*<div class="input-group-btn" style="margin-left:1px;">
                        <button type="button" class="btn btn-default" style="border: 1px solid transparent;">
                            更多搜索
                            <span class="caret"></span>
                        </button>
                    </div>*@
            </div>
        </div>
    </div>

    <div id="Table">
        <div class="overflow">
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                        <th width="25"><input type="checkbox" class="AllClickCheckbox"></th>
                        <th class="text-center">头像</th>
                        <th class="text-center">客户名称</th>
                        <th class="text-center">联系电话</th>
                        <th class="text-center">地址</th>
                        <th class="text-center">参与活动次数</th>
                        <th class="text-center">上次活跃时间</th>
                        <th class="text-center">操作</th>
                    </tr>
                </thead>
                <tbody id="MarkeTtable" style="display:none;" binding="{'pageId':'ShoppingPager','pageCallback':'$.MGJ.CustomerInfo.Ajax_MarketUserList','emptyHtml':User_Html}">
                    <tr>
                        <td width="25"><input type="checkbox" binding="{'ID':'ID'}" class="AllClickChild"></td>
                        <td>
                            <img onerror="javascript: this.src = 'https://15448716.h40.faiusr.com/2/7/ACgIABACGAAgpp_Q0QUoltP6qAIw9AM49AM.jpg'" binding="{'src':'HeadImgUrl'}" alt="null" style="width:30px;height:30px;border-radius:3px" />
                        </td>
                        <td binding="{'text':'Nickname','textHandle':$.MGJ.CustomerInfo.Bin_Base64Nickname}"></td>
                        <td binding="{'text':'Phone'}"></td>
                        <td binding="{'text':'Country,Provnice,City','textFormat':'{0}-{1}-{2}'}"></td>
                        <td binding="{'text':'count'}"></td>
                        <td binding="{'text':'OA_Time','textHandle':'datetime'}"></td>
                        <td>
                            @*<a binding="{'MID':'ID'}" onclick="$.MGJ.CustomerInfo.Dialog_CustomerParticulars(this)">详情</a>*@
                            <a binding="{'uID':'ID'}" onclick="$.MGJ.CustomerInfo.Dialog_CustomerRecord(this)">交易记录</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="ShoppingPager"></div>
    </div>

</div>

<script>

    var UserColspanNub = $(".table.table-hover.table-bordered").find("tr").children("td").length
    window.User_Html = '<tr><td colspan="' + UserColspanNub + '"><p class="no-result">无符合条件的数据结果</p></td></tr>';
    $.MGJ.CustomerInfo.Ajax_MarketUserList(1);
    $.MGJ.CustomerInfo.Ajax_MarketUserList("", 1, 10);

    function decode(input) {
        _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
        while (i < input.length) {
            enc1 = _keyStr.indexOf(input.charAt(i++));
            enc2 = _keyStr.indexOf(input.charAt(i++));
            enc3 = _keyStr.indexOf(input.charAt(i++));
            enc4 = _keyStr.indexOf(input.charAt(i++));
            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;
            output = output + String.fromCharCode(chr1);
            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }
        }
        output = _utf8_decode(output);
        return output;
    }
    function _utf8_decode(utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;
        while (i < utftext.length) {
            c = utftext.charCodeAt(i);
            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            } else if ((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i + 1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            } else {
                c2 = utftext.charCodeAt(i + 1);
                c3 = utftext.charCodeAt(i + 2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
        }
        return string;
    }
</script>




